﻿<UserControl x:Class="Markup.Programming.Samples.OneMethodTwoBindings.View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="http://markupprogramming.codeplex.com/markup/programming"
    xmlns:local="clr-namespace:Markup.Programming.Samples.OneMethodTwoBindings"
    Height="300" Width="300">
    <UserControl.Resources>
        <local:ViewModel x:Key="ViewModel"/>
    </UserControl.Resources>
    <UserControl.DataContext>
        <Binding Source="{StaticResource ViewModel}"/>
    </UserControl.DataContext>
    <StackPanel>
        <Button Content="Match Boy with Girl">
            <p:Attached.Operations>
                <p:CallHandler Path="Click => Match" SetHandled="True">
                    <p:Get Source="{Binding SelectedValue, ElementName=Boys}"/>
                    <p:Get Source="{Binding SelectedValue, ElementName=Girls}"/>
                </p:CallHandler>
            </p:Attached.Operations>
        </Button>
        <UniformGrid Columns="2">
            <ListBox Name="Boys" ItemsSource="{Binding Boys}"/>
            <ListBox Name="Girls" ItemsSource="{Binding Girls}"/>
        </UniformGrid>
    </StackPanel>
</UserControl>
